package com.gee.spring.boot.influxdb.core.query.domain;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
 * @author gepengjun
 * @since 2024/4/28 14:05
 */
public class MeasurementInfo {

    private String measurement;

    private String timeFuncAlias;

    private Field timeField;

    //columnName  fieldName
    private final Map<String, String> columnFieldMap = new HashMap<>();

    private final Map<String, ColumnInfo> fieldColumnInfoMap = new HashMap<>();

    public MeasurementInfo(String measurement) {
        this.measurement = measurement;
    }

    public Field getField(String column){
        return fieldColumnInfoMap.get(columnFieldMap.get(column)).getField();
    }

    public ColumnInfo getColumnInfo(String fieldName){
        return fieldColumnInfoMap.get(fieldName);
    }

    public String getMeasurement() {
        return measurement;
    }

    public void setMeasurement(String measurement) {
        this.measurement = measurement;
    }

    public Map<String, String> getColumnFieldMap() {
        return columnFieldMap;
    }

    public Map<String, ColumnInfo> getFieldColumnInfoMap() {
        return fieldColumnInfoMap;
    }

    public String getTimeFuncAlias() {
        return timeFuncAlias;
    }

    public void setTimeFuncAlias(String timeFuncAlias) {
        this.timeFuncAlias = timeFuncAlias;
    }

    public Field getTimeField() {
        return timeField;
    }

    public void setTimeField(Field timeField) {
        this.timeField = timeField;
    }
}
